package com.example.lanqiaodemo1.java10;

import java.util.ArrayList;
import java.util.List;

public class EmployeeManage {
    static List<Employee> list=new ArrayList<>();
    public static double getAverageAge(){
        double sum=0;
        for (int i = 0; i < list.size(); i++) {
            sum+=list.get(i).getAge();
        }
        return sum/list.size();
    }

    public static void addEmployee(Employee e){
        list.add(e);
    }

    public static void main(String[] args) {
        Employee e1 = new Employee(5,"hggh",1);
        Employee e2 = new Employee(3,"hhh",2);
        Employee e3 = new Employee(2,"hhjkk",3);
        addEmployee(e1);
        addEmployee(e2);
        addEmployee(e3);
        System.out.println(getAverageAge());
    }




}
